﻿<!DOCTYPE html>
<!----类别管理---->
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="/static/js/common.js"></script>

    <title></title>
    <!-- 行内编辑 css-->
    <style>
        .tb-edit .el-input {
            display: none
        }

        .tb-edit .current-row .el-input {
            display: block
        }

        .tb-edit .current-row .el-input+span {
            display: none
        }

        .xian {
            display: block;
            text-align: center;
        }

        .yin {
            display: none;
            text-align: center;
        }

        .lineMust {
            position: absolute;
            right: 15px;
            bottom: 6px;
            bottom: 3px\0 !important;
            /* 兼容ie */
        }
    </style>
    <!-- 行内编辑 css-->
</head>

<body>
    
<div id="app" v-cloak>   
        <el-form label-position="right" ref="form" :inline="true" :model="formInline" class="demo-form-inline"
            style="margin-bottom: 15px;">
            <el-row>
                <el-col class="head-tool">
                    
<div class="new_title fl"><strong><img src="/static/images/icon1.png" />文件级别管理列表</strong></div>
                    <span>
                        <btn :text="col.btnSelect" imgsrc="/static/images/search.png" linetype="3" @click="onSubmit">
                        </btn>
                        <btn :text="col.btnAdd" linetype="3" @click="add"></btn>
                        <btn-export-list url="/api/FL_FileLevel/Export" :forminline="this.formInline" linetype="3"></btn-export-list>
                        <btn :text="col.btnDelete" linetype="4" @click="onDelete"></btn>
                    </span>
                </el-col>
            </el-row>

            <el-row>


                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.fileLeve"
                                :placeholder="CategoryManagementList0529.CM_ClassName" size="mini">
                                <template slot="prepend">
                                    {{CategoryManagementList0529.CM_ClassName+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <el-col :xs="8" :sm="8" :md="8" :lg="6" :xl="6">
                    <div class="elst-select-mini">
                        <el-form-item>
                            <el-input v-model="formInline.model.remarks" :placeholder="LawRegulationsTable.Remarks"
                                size="mini">
                                <template slot="prepend">
                                    {{LawRegulationsTable.Remarks+mark.m}}
                                </template>
                            </el-input>
                        </el-form-item>
                    </div>
                </el-col>
                <!--<el-col :xs="24" :sm="12" :md="12" :lg="6" :xl="6">
                    <el-form-item :label="CategoryManagementList0529.CM_ClassName+mark.m" prop="CM_ClassName" class="redItem">
                        <el-input type="text" v-model="formInline.model.aaa" autocomplete="off" style="width:200px;margin-left:40px;"></el-input>
                    </el-form-item>
                </el-col>-->


            </el-row>

        </el-form>

        <!--表格开始-->

        <el-table ref="table" stripe @current-change="tableHandleCurrentChange" class="tb-edit"
            :data="ListItem.tableData" :row-key="getRowKeys" :height="ListItem.tableHeight" border
            @selection-change="handleSelectionChange" row-style="height:10px" style="width: 100%;">
            <el-table-column type="selection" style="padding-top: 0px;padding-bottom: 0px;" align="center" width="55"
                :reserve-selection="true">
            </el-table-column>
            <el-table-column type="index" :label="col.SequenceNumber" :index="indexMethod" width="50"
                show-overflow-tooltip="true"></el-table-column>


            <!-- 行内编辑 html-->
            <el-table-column :label="CategoryManagementList0529.CM_ClassName">
                <template scope="scope">
                    <el-input size="mini" v-model="scope.row.fileLeve" placeholder="请输入内容" @blur="handblur">
                    </el-input>
                    <span>{{scope.row.fileLeve}}</span>
                    <span class="lineMust" v-if="scope.row.fileLeve.length<=0">
                        <!-- 必填项添加 -->
                        <img src="/static/images/exclamation.png" alt="">
                    </span>
                </template>
            </el-table-column>
            <el-table-column :label="CategoryManagementList0529.CM_Mark">
                <template scope="scope">
                    <el-input size="mini" v-model="scope.row.remarks" placeholder="请输入内容" @blur="handblur">
                    </el-input>
                    <span>{{scope.row.remarks}}</span>
                </template>
            </el-table-column>
            <el-table-column :label="CategoryManagementList0529.CM_Person">
                <template scope="scope">
                    <span>{{scope.row.mark01}}</span>
                </template>
            </el-table-column>
            <el-table-column :label="CategoryManagementList0529.CM_Time">
                <template scope="scope">
                    <span>{{scope.row.createTime}}</span>
                </template>
            </el-table-column>


            <el-table-column width="90" prop="update" :label="col.stWork">
                <template slot-scope="scope">
                    <span class="start xian">
                        <button type="button" class="elst-bt-xg" @click=Edit('xg',scope.row.id,scope.$index)>
                            <i class="el-icon-edit"></i>
                        </button>
                    </span>
                    <span class="end yin">
                        <button type="button" class="elst-bt-xg " @click="Save(scope.$index, scope.row)">
                            <i class="el-icon-circle-check-outline"></i>
                            <!-- 保存 -->
                        </button>
                        <button type="button" class="elst-bt-xg " @click="Back(scope.$index, scope.row)">
                            <i class="el-icon-circle-close-outline"></i>
                            <!-- 撤销 -->
                        </button>
                    </span>
                </template>
            </el-table-column>
            <!-- 行内编辑 html-->


            <!-- <el-table-column prop="CM_Id" :label="CategoryManagementList0529.CM_Id" width="55">
            </el-table-column>
            <el-table-column prop="CM_ClassName" :label="CategoryManagementList0529.CM_ClassName">
            </el-table-column>
            <el-table-column prop="CM_Person" :label="CategoryManagementList0529.CM_Person">
            </el-table-column>
            <el-table-column prop="CM_Time" :label="CategoryManagementList0529.CM_Time">
            </el-table-column>
            <el-table-column prop="CM_Mark" :label="CategoryManagementList0529.CM_Mark">
            </el-table-column>

            <el-table-column width="53" prop="update" :label="col.btnUpdate" fixed="right">
                <template slot-scope="scope">
                    <button type="button" class="elst-bt-xg" @click=UserInput('xg',scope.row.id)>
                        <i class="el-icon-edit"></i>
                    </button>
                </template>
            </el-table-column> -->

        </el-table>
        <!--表格结束-->
        <!--分页开始-->
        <el-row type="flex" justify="end">


            <el-pagination ref="page" @size-change="handleSizeChange" @current-change="handleCurrentChange"
                :current-page="ListItem.currentPage" :page-sizes="ListItem.pagesizes" :page-size="ListItem.pagesize"
                :layout="ListItem.layout" :total="ListItem.total">
            </el-pagination>

        </el-row>
        <!--分页结束-->

    </div>
    <script type="text/javascript">
        // 动态获取日期
        var myDate = new Date(new Date().setDate(new Date().getDate()));    //获取当前年份(2位)
        var year = myDate.getFullYear();    //获取完整的年份(4位,1970-????)
        var month = myDate.getMonth();       //获取当前月份(0-11,0代表1月)
        if (month < 10) {
            month = "0" + (month * 1 + 1);
        };
        var day = myDate.getDate();        //获取当前日(1-31)
        if (day < 10) {
            day = "0" + day;
        };
        var dayNow = year + '-' + (month) + "-" + day;
        var app = new Vue({
            el: '#app',
            data: {
                //行内编辑 添加内容设置
                Form: {
                    // id: gutid,
                    // CM_Id: gutNum, // '999999',
                    fileLeve: '',
                    CM_Person: '123',
                    CM_Time: dayNow,
                    remarks: '',
                },
                // 行内编辑 添加内容设置
                //表单内容
                ListItem: ListItem,

                formInline: {
                    model: { CM_Mark: '' },
                    offset: 0,
                    limit: 10
                }
            },
            mounted: function () {

                // console.log(CategoryManagementList0529);
                //console.log(CategoryManagementList0529.CM_Id);
                //console.log(CategoryManagementList0529.CM_ClassName);
                //console.log(CategoryManagementList0529.CM_Person);
                //console.log(CategoryManagementList0529.CM_Time);
                //console.log(CategoryManagementList0529.CM_Mark);
                //初始化数据

                this.GetPageData(1);
                //列表高度自适应
                tablehigh(this);
                //获取下拉菜单内容
              //  this.FileLeve = getDicData('65');
            },
            methods: {
                //解決edge下select bug
                visibleChange: function (isVisible) {
                    visibleChange(isVisible)
                },
                // 行内编辑 js
                add: function (formName) {
                    if ($('tbody tr').attr("class") == "el-table__row current-row") {
                        showMessage(msg.EditingNotCompleted, 'error');
                    } else {
                        this.Form.fileLeve = '';//添加是清空录入数据的，每一项都要有
                        this.Form.remarks = '';//添加是清空录入数据的，每一项都要有
                        $('.el-table__row').removeClass('current-row');
                        $('.el-table__row span.end').removeClass('xian');
                        $('.el-table__row span.end').addClass('yin');
                        $('.el-table__row span.start').removeClass('yin');
                        $('.el-table__row span.start').addClass('xian');
                        this.ListItem.tableData.unshift(this.Form);
                        setTimeout(function () {
                            $('.el-table__row:eq(0)').addClass('current-row');
                            $('.el-table__row:eq(0) span.end').removeClass('yin');
                            $('.el-table__row:eq(0) span.end').addClass('xian');
                            $('.el-table__row:eq(0) span.start').removeClass('xian');
                            $('.el-table__row:eq(0) span.start').addClass('yin');
                        }, 100);
                    }
                },
                //修改
                Edit: function (val, id, index) {
                    $('.el-table__row').removeClass('current-row');
                    $('.el-table__row:eq(' + index + ')').addClass('current-row');
                    $('.el-table__row span.end').removeClass('xian');
                    $('.el-table__row span.end').addClass('yin');
                    $('.el-table__row span.start').removeClass('yin');
                    $('.el-table__row span.start').addClass('xian');
                    $('.el-table__row:eq(' + index + ') span.end').removeClass('yin');
                    $('.el-table__row:eq(' + index + ') span.end').addClass('xian');
                    $('.el-table__row:eq(' + index + ') span.start').removeClass('xian');
                    $('.el-table__row:eq(' + index + ') span.start').addClass('yin');
                },
                // 保存  注意去掉mock中的parent 否则无法保存
                Save: function (a, b) {
                    if (!b.fileLeve) {
                        showMessage(msg.NoMust, 'error');
                    } else {
                    

                        $('.el-table__row').removeClass('current-row');
                        console.log("a", a);
                        console.log("b", b);
                        $('.el-table__row span.end').removeClass('xian');
                        $('.el-table__row span.end').addClass('yin');
                        $('.el-table__row span.start').removeClass('yin');
                        $('.el-table__row span.start').addClass('xian');
                        this.onSubmitForm('form', b);
                        //初始化数据
                        // this.GetPageData(1);
                        setTimeout(this.GetPageData, 100);
                        // window.setTimeout(this.GetPageData(1), 3000);

                    }
                },
                Back: function (a, b) {
                    $('.el-table__row').removeClass('current-row');
                    $('.el-table__row span.end').removeClass('xian');
                    $('.el-table__row span.end').addClass('yin');
                    $('.el-table__row span.start').removeClass('yin');
                    $('.el-table__row span.start').addClass('xian');
                    //初始化数据
                    this.GetPageData(1);
                },
                onSubmitForm: function (formName, obj) {
                    var mythis = this;
                    this.$refs[formName].validate(function (valid) {
                       
                        //验证通过
                        if (valid) {
                            onSubmitForm(this, '/api/FL_FileLevel/Save', obj);
                           // onSubmitForm(this, '/api/CategoryManagementList/Save', obj);
                        } else {
                            //验证失败
                            return false;
                        }
                    });
                },
                handblur: function () {
                    this.$refs.table.setCurrentRow(999);
                    console.log("c", 'c');
                },
                //table选中行handle
                tableHandleCurrentChange: function (currentRow) {
                    this.currSeelctId = currentRow.id;
                    this.currSeelctCell = currentRow;
                },
                // 行内编辑 js
                indexMethod: function (index) {
                    return (this.ListItem.currentPage - 1) * this.ListItem.pagesize + index + 1;
                },




                //关闭Dialog 回调
                closeDialog: function () { closeDialog(this); },
                //删除方法
                onDelete: function () { onDelete(this, '/api/FL_FileLevel/DeleteMuti'); },
                //列表选择触发
                handleSelectionChange: function (val) { handleSelectionChange(this, val); },
                //Dialog展示
                UserInput: function (val, id) { DialogShow(this, val, "CategoryManagementInput.html", id); },
                //获取分页数据
                GetPageData: function (currentIndex) {
                    GetPageData(this, currentIndex, '/api/FL_FileLevel/GetList')
                },
                ale: function(){
                    alert()

                },

                //查询方法
                onSubmit: function () { onSubmit(this); },
                //pagesize改变 触发方法
                handleSizeChange: function (val) { handleSizeChange(this, val); },
                //跳页触发方法
                handleCurrentChange: function (val) { handleCurrentChange(this, val); },

                //导出--暂时此提示--之后根官标实现
                //FileExcel: function () { alert("导出成功") },
                FileExcel: function () {
                    myAjax("post", this, '/api/CategoryManagementList/export', null,
                        function (response) {
                            console.log(response);
                            if (response.result == "Success") {
                                showMessage(response.message, 'success');
                            }
                            else {
                                showMessage(response.message, 'fail');
                            }

                        });
                },


            }


        });
    </script>
</body>

</html>